package company.pingan_F;

import java.util.Scanner;

public class PingAn1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] s = str.split(" ");
        if (s[0].length() != s[1].length()) {
            System.out.println("false");
            return;
        }

        //可以合并到一个字典里面 26+26+10 设置好偏移量
        int[] charDict1 = new int[26];
        int[] charDict2 = new int[26];
        int[] numDict = new int[10];

        for (int i = 0; i < s[0].length(); i++) {
            char c1 = s[0].charAt(i);
            char c2 = s[1].charAt(i);
            if (c1 >= 'a' && c1 <= 'z') {
                charDict1[c1 - 'a']++;
            } else if (c1 >= 'A' && c1 <= 'Z') {
                charDict2[c1 - 'A']++;
            } else if (c1 >= '0' && c1 <= '9') {
                numDict[c1 - '0']++;
            }

            if (c2 >= 'a' && c2 <= 'z') {
                charDict1[c2 - 'a']--;
            } else if (c2 >= 'A' && c2 <= 'Z') {
                charDict2[c2 - 'A']--;
            } else if (c2 >= '0' && c2 <= '9') {
                numDict[c2 - '0']--;
            }
        }

        for (int i = 0; i < charDict1.length; i++) {
            if (charDict1[i] != 0 || charDict2[i] != 0 || (i < 10 && numDict[i] != 0)) {
                System.out.println("false");
                return;
            }
        }
        System.out.println("true");
    }
}
